﻿using RS.SAAS.Common.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace TimeManagementMobile
{
    public static class PathHelper
    {
        public static string GetBaseUrl()
        {
            return ConfigurationAccessor.Get("BaseUrl");
        }

        public static string GetCurrentTheme()
        {
            return ConfigurationAccessor.Get("theme", "base");
        }

        public static string GetCurrentThemePath()
        {
            return HttpContext.Current.Server.MapPath(string.Format("~/Content/themes/{0}/", GetCurrentTheme()));
        }

        public static string GetCurrentThemeUrl()
        {
            return string.Format("{0}Content/themes/{1}/", GetBaseUrl(), GetCurrentTheme());
        }

        public static string GetCurrentImagesUrl()
        {
            return GetCurrentThemeUrl() + "img/";
        }

        public static string GetResourcePath(string fileName)
        {
            if (string.IsNullOrWhiteSpace(fileName))
                return string.Empty;

            return string.Format("{0}img/{1}", GetCurrentThemePath(), fileName);
        }

        public static string GetResourceUrl(string fileName)
        {
            if (string.IsNullOrWhiteSpace(fileName))
                return string.Empty;

            return string.Format("{0}img/{1}", GetCurrentThemeUrl(), fileName);
        }
    }
}